import axios from 'axios';
import qs from 'query-string';

export interface NoteId {
    id: number;
}

export interface NoteRecord {
    id: number;
    phone: string;
    content: string;
    created_at: number;
    updated_at: number;
    do_at?: number;
    status: number; // 0-未处理 1-已处理
}

export interface NoteListRes {
    list: NoteRecord[];
    total: number;
}

export interface NoteParams {
    current: number;
    pageSize: number;
    phone?: string; // 手机号搜索
}

/**
 * 获取合作意向列表
 * @param params
 */
export function queryNoteList(params: NoteParams) {
    return axios.get<NoteListRes>('/admin/note/index', {
        params,
        paramsSerializer: (obj) => {
            return qs.stringify(obj);
        },
    });
}

/**
 * 处理合作意向
 * @param id
 */
export function processNote(id: number) {
    return axios.post('/admin/note/process', { id });
} 